﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TrayCheckControl
{
    public class EnvironmentSet : System.ComponentModel.INotifyPropertyChanged
    {
        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(string propertyName)
        {
            if(null != this.PropertyChanged)
            {
                this.PropertyChanged(this,
                    new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }

        private IpEndPointSet serverSet = new IpEndPointSet();
        private CarrierSet carrierSet = new CarrierSet();
        private bool bypass = false;
        public bool Enable { get => !bypass; }

        public IpEndPointSet ServerSet
        {
            get => this.serverSet;
            set
            {
                this.serverSet.Copy(value);
                this.OnPropertyChanged("ServerSet");
            }
        }
        public CarrierSet CarrierSet
        {
            get => this.carrierSet;
            set
            {
                this.carrierSet.Copy(value);
                this.OnPropertyChanged("CarrierSet");
            }
        }
        public bool Bypass
        {
            get => this.bypass;
            set
            {
                this.bypass = value;
                this.OnPropertyChanged("Bypass");
            }
        }
        public void Copy(EnvironmentSet envSet)
        {
            this.ServerSet = envSet.serverSet;
            this.CarrierSet = envSet.carrierSet;
            this.Bypass = envSet.bypass;
        }
    }
}
